package com.wz.mapper;

import com.wz.entity.Emp;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmpMapper {
    //查找所有数据
    @Select("select * from emp")
    List<Emp> findEmp();

    //根据id查找数据
    @Select("select * from emp where empno=#{empno}")
    Emp getEmpById(String empno);

    //添加数据
    @Insert("insert into emp(empno,ename,job,mgr,hiredata,sal,comm,deptno) values(#{empno},#{ename},#{job},#{mgr},#{hiredata},#{sal},#{comm},#{deptno})")
    int saveEmp(Emp emp);

    //删除数据
    @Delete("delete  from emp where empno=#{empno}")
    Integer deleteEmp(String empno);

    //更新数据
    @Update("update emp set empno=#{empno},ename=#{ename},job=#{job},mgr=#{mgr},hiredata=#{hiredata},sal=#{sal},comm=#{comm},deptno=#{deptno} where empno=#{empno}")
    int updateEmp(Emp emp);
}
